<?php
//dezend by http://www.yunlu99.com/ QQ:270656184
defined('BASEPATH') || exit('No direct script access allowed');
$this->load->helper('url');
?><div class="user-body">
  	<div class="body-content">
      <div class="body-title">
        	资金帐号
      </div>
      
      <!-- <div class="coins">
      	<a href="<?php echo site_url('channels/card');?>">人民币（CNY）</a>
      	
<?php
foreach ($coins as $v) {
?>      	<a 
<?php
	if ($coin['id'] == $v['id']) {
?>class="on"<?php
	}

?> href="javascript:void(0);" class="coin-tab" data-id="<?php echo $v['id'];?>"><?php echo $v['cn_name'];?>（<?php echo $v['en_name'];?>）</a>
      	<?php
}

?>      	<div class="clear"></div>
      </div> -->
      
      
<?php
if (11 < count($coins)) {
?>      <div class="coins">
      	<a class="on">
      		<select id="coin_id" style="border:0px;">
      			<option value="0">CNY</option>
		        
<?php
	foreach ($coins as $v) {
?>		        <option value="<?php echo $v['id'];?>" 
<?php
		if ($coin['id'] == $v['id']) {
?>selected<?php
		}

?>><?php echo $v['en_name'];?></option>
		        <?php
	}

?>	        </select>
      	</a>
      	<div class="clear"></div>
      	<script type="text/javascript">
      	$(function(){
      		$('#coin_id').change(function(){
				if($(this).val() == 0){
					location.href = '<?php echo site_url('channels/card');?>';
				}else{
					$.cookie('coin_id',$(this).val());
					location.href = '<?php echo site_url('channels/address');?>';
				}
			});
		});
      	</script>
      </div>
      <?php
}
else {
?>      <div class="coins">
      	<a class="on">CNY</a>
      	
<?php
	foreach ($coins as $v) {
?>      	<a 
<?php
		if ($coin['id'] == $v['id']) {
?>class="on"<?php
		}

?> href="javascript:void(0);" class="coin-tab" data-id="<?php echo $v['id'];?>"><?php echo $v['en_name'];?></a>
      	<?php
	}

?>      	<div class="clear"></div>
      </div>
      <script type="text/javascript">
      $(function(){
	      $('.coin-tab').click(function(){
				$.cookie('coin_id',$(this).attr('data-id'));
				location.reload();
	      });
      });
	  </script>
      <?php
}

?>       
      <div class="form">
      <form action="<?php echo site_url('channels/address_insert');?>" method="post" id="form_id">
      	<input type="hidden" name="coin_id" value="<?php echo $coin['id'];?>">
      	<table cellspacing=0 cellpadding=0 border=0>
      		<tr><th>钱包地址：</th><td><input type="text" name="code"><p>请输入钱包地址</p></td></tr>
      		<tr><th>安全密码：</th><td><input type="password" name="paypwd"><p>请输入安全密码</p></td></tr>
      		<tr><th></th><td class="warning"></td></tr>
      		<tr><th></th><td><button type="submit"><?php echo lang('money_card_btn');?></button></td></tr>
      	</table>
      </form>
      </div>
      <script type="text/javascript">
		$(function(){
			$('#form_id').checkForm();
			
		});
      </script>
      
      <div class="list">
      	<h3>钱包地址列表</h3>
      	<table cellspacing=0 cellpadding=0 border=0>
			<thead>
				<tr>
					<th><?php echo lang('money_coin');?></th>
					<th><?php echo lang('money_address');?></th>
					<th><?php echo lang('money_action');?></th>
				</tr>
			</thead>
			<tbody>
				
<?php
foreach ($list as $v) {
?>				<tr>
					<td><?php echo $coin['en_name'];?></td>
					<td><?php echo $v['code'];?></td>
					<td><a class="delete-btn" href="javascript:void(0);" data-id="<?php echo $v['id'];?>"><?php echo lang('money_delete');?></a></td>
				</tr>
				<?php
}

?>			</tbody>
		</table>
		<div class="page">
		  <?php echo $page;?>		</div>
		<div class="clear"></div>
      </div>
    </div>
  </div>
  <div class="clear"></div>
</div>
<script>
$(function(){
	$('.delete-btn').single('<?php echo site_url('channels/address_del');?>');
	$('.coin-tab').click(function(){
		$.cookie('coin_id',$(this).attr('data-id'));
		location.reload();
	});
});
</script>